<?php

/**
 * Hoa Framework
 *
 *
 * @license
 *
 * GNU General Public License
 *
 * This file is part of HOA Open Accessibility.
 * Copyright (c) 2007, 2008 Ivan ENDERLIN. All rights reserved.
 *
 * HOA Open Accessibility is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * HOA Open Accessibility is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with HOA Open Accessibility; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *
 * @category    Framework
 * @package     Hoathis_Convertor
 *
 */

/**
 * Hoa_Framework
 */
require_once 'Framework.php';

/**
 * Hoathis_Convertor_Format_Abstract
 */
importModule('Convertor.Format.Abstract');

/**
 * Class Hoathis_Convertor_Format_Liquid
 *
 * Extending the Hoathis_Convertor_Format_Abstract class.
 *
 * @author      Gregory DARCHE <tetardo@gmail.com>
 * @copyright   Copyright (c) 2009 Gregory DARCHE.
 * @license     http://gnu.org/licenses/gpl.txt GNU GPL
 * @since       PHP 5
 * @version     0.1
 * @package     Hoathis_Convertor
 * @subpackage  Hoathis_Convertor_Format
 */
Class Hoathis_Convertor_Format_Liquid extends Hoathis_Convertor_Format_Abstract {

    protected $units = array(
        'yL' 	=> 0.000000000000000000000001,
        'zL' 	=> 0.000000000000000000001,
        'aL' 	=> 0.000000000000000001,
        'fL' 	=> 0.000000000000001,
        'pL' 	=> 0.000000000001,
        'nL' 	=> 0.000000001,
        'µL' 	=> 0.000001,
        'mL' 	=> 0.001,
        'cL' 	=> 0.01,
        'dL' 	=> 0.1,
        'L' 	=> 1,
        'daL' 	=> 10,
        'hL' 	=> 100,
        'KL' 	=> 1000,
        'ML' 	=> 1000000,
        'GL'	=> 1000000000,
        'TL' 	=> 1000000000000,
        'PL' 	=> 1000000000000000,
        'EL' 	=> 1000000000000000000,
        'ZL' 	=> 1000000000000000000000,
        'YL' 	=> 100000000000000000000000
    );

    protected $filters = array(
        'Pourcent',
        'Round',
        'Number',
        'Unit'
    );

    protected function convert( $value, $from, $to ) {

        return ( $value * $this->units[$from] ) / $this->units[$to];
    }
}